<template>
	<view class="animated fadeIn faster">
		<!-- <view class="p-3">
			<view class="search-box d-flex d-flex-middle d-flex-between pl-2">
				<input class="d-flex-item" placeholder="请输入关键词搜索试卷" placeholder-class="colorhold" />
				<view class="px-2">
					<text class="iconfont icon-icon_sousuo main-color font-bold font32"></text>
				</view>
			</view>
		</view> -->
		<view class="p-3">
			<view class="bg-fff rounded15 p-2 mb-3" v-for="exame in actList" :key="exame.id" @click="goExam(exame.id)">
				<view class="text-clamp mb-2">
					<text class="color666">{{exame.name}}</text>
				</view>
				<view class="d-flex mb-1">
					<!-- <text class="colorhold font22 mr-1">试题50道</text> -->
					<text class="colorhold font24 mr-2">试卷总分{{exame.total_score}}</text>
					<!-- <text class="colorhold font22 mr-1">及格线50</text> -->
					<text class="colorhold font24">考试时间{{exame.duration}}分钟</text>
				</view>
				<view class="d-flex d-flex-end">
					<view class="rounded50 border-main d-flex d-flex-middle d-flex-center" style="width: 120rpx;height: 46rpx;">
						<text class="main-color font22">开始考试</text>
					</view>
				</view>
			</view>
			
			<view class="load-more d-flex d-flex-center d-flex-column d-flex-middle">
				<image class="mb-2" v-if="loadingType == 2 && actList.length == 0"
					src="https://yuexiaoda-1314351529.cos.ap-shanghai.myqcloud.com/formal/images/empty.png"
					style="width: 198rpx;height: 128rpx;margin-top: 260rpx;"></image>
				<text>{{loadingType === 0 ? '上拉显示更多' : (loadingType === 1 ? '正在加载...' : '~ 没有更多数据了 ~')}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import { userApi } from '@/http/userApi.js'
	import store from '@/store/index.js'
	import {mapState} from "vuex"
	export default {
		data() {
			return {
				loadingType: 2,
				actList:[]
			}
		},
		computed: {
		  ...mapState({
		    cid: state => state.cid
		  }),
		},
		onReady() {
			this.getTopicList()
		},
		methods: {
			getTopicList(){
				let that = this
				uni.showLoading({
					title:'加载中...',
					mask:true
				})
				userApi.getTrueExamList(that.cid).then((res)=>{
					uni.hideLoading()
					that.actList = res.exams
				}).catch((e)=>{
					uni.hideLoading()
				})
			},
			goExam(eid){
				uni.navigateTo({
					url:'/subPages/evaluation/evaluation?eid='+eid
				})
			}
		}
	}
</script>

<style>

</style>
